home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Hot Mix 17
/
Hot Mix 17.iso
/
HM17_SGI
/
research
/
examples
/
misc
/
wexmast
/
wmtest.pro
< prev
next >
Wrap
Text File
|
1997-07-08
|
2KB
|
66 lines
; $Id: wmtest.pro,v 1.4 1997/01/15 04:29:15 ali Exp $
;
; Copyright (c) 1993-1997, Research Systems, Inc. All rights reserved.
; Unauthorized reproduction prohibited.
; This is the code for a simple non-exclusive menu widget.
; The menu contains a list of colors. When a button is
; pushed in (selected), the message, "Color selected."
; is printed in the IDL window. When a button that has
; been previously pushed in is de-selected, the message
; "Color de-selected." is printed in the IDL window.
; Non-exclusive menus are lists of buttons in which any
; number of buttons can be selected at the same time.
; For an example of an exclusive menu, see the routine
; WEXCLUS.PRO.
PRO wmtest_event, event
; This procedure is the event handler for a non-exclusive menu widget.
; Use event.value to get the VALUE of any action:
; When a widget event occurs, an event structure is returned.
; Part of that structure is a 'select' field that is equal to
; 1 if a button was selected or 0 if the button was de-selected.
; For Menu items, any VALUE returned will be the text of the menu item.
; Therefore, we can just print out the words as they are selected.
IF (event.select EQ 1) THEN PRINT, event.value, ' selected.' $
ELSE PRINT, event.value, ' de-selected.'
END
PRO wmtest, GROUP = GROUP
; This procedure creates a non-exclusive menu widget.
; Make the top-level base widget:
base = WIDGET_BASE(TITLE = 'Non-Exclusive Menu Example', /COLUMN, XSIZE = 300)
; Make 'items' a 1-dimensional text array containing the menu items:
items = ['Red','Orange','Yellow','Green','Blue','Indigo','Violet']
; The CW_BGROUP procedure will automatically create the menu items for us.
; We only have to give it the menu item labels (in the array 'items')
; and, optionally, the base to which the menu belongs (here we use 'base',
; the top-level base widget). The /NONEXCLUSIVE keyword makes the
; menu non-exclusive:
menu = CW_BGROUP(base, items, /NONEXCLUSIVE, IDS = buttons, /RETURN_NAME)
; Realize the widgets:
WIDGET_CONTROL, base, /REALIZE
; Hand off to the XMANAGER:
XMANAGER, 'wmtest', base, GROUP_LEADER = GROUP, /NO_BLOCK
END